package router

import (
	"blog/app/http"

	"github.com/gin-gonic/gin"
)

func (router *Router) article(group *gin.RouterGroup) {
	article := group.Group("article")
	//article.Use(middleware.Middleware.Auth.IsLogin())
	api := http.ApiGroup
	{
		articleApi := api.ArticleApi
		article.POST("", router.handFunc(articleApi.Create))
		article.POST("/edit/:id", articleApi.Edit)
		article.DELETE(":id", router.handFunc(articleApi.Del))
		article.GET(":id", router.handFunc(articleApi.GetInfo))
		article.GET("", router.handFunc(articleApi.GetLists))
	}
	//// 分类
	{
		cateApi := api.ArticleCateApi
		cate := article.Group("cate")
		cate.POST("create", cateApi.Create)
		cate.GET("", cateApi.GetLists)
		cate.GET(":id", cateApi.GetInfo)
		cate.PUT(":id", cateApi.Edit)
		cate.DELETE(":id", cateApi.Del)
	}
	////标签
	{
		tagApi := api.ArticleTagApi
		tag := article.Group("tag")
		tag.GET("/", tagApi.GetLists)
		tag.GET(":id", tagApi.GetInfo)
		tag.POST("create", tagApi.Create)
		tag.PUT(":id", tagApi.Edit)
		tag.DELETE(":id", tagApi.Del)
	}
}
